import UIKit
//https://www.jianshu.com/p/b6c20c1fca4f
class Person {
    var closure: (String)->() = { name in
        print(name)
    }
    var name: String
    init(name: String) {
        self.name = name
    }
    func test() {
        self.closure = {[weak self] name in
            //第1种解包
            self?.name = "小李"
            //第2种解包:可选绑定
            if let weakself = self {
                print("weak self")
            }
            if let self {
                self.name
            }
            guard let self else {
                return
            }
            self.name
        }
        
        self.closure = {[unowned self] name in
            
        }
    }
}
